namespace SimpleWebServices.IO
{
    using System;
    using System.IO;
    using System.Web;
    using SimpleWebServices;
    using Xunit;

    public sealed class SerializationFileFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(new ObjectExpectations<SerializationFile>()
                .DerivesFrom<object>()
                .IsConcreteClass()
                .IsSealed()
                .NoDefaultConstructor()
                .Implements<IDisposable>()
                .Result);
        }

        [Fact]
        public void ctor_Exception()
        {
            using (SerializationFile obj = new SerializationFile(new HttpException()))
            {
                Assert.NotNull(obj);
            }
        }

        [Fact]
        public void ctor_ExceptionNull()
        {
            Assert.Throws<ArgumentNullException>(() => new SerializationFile(null as Exception));
        }

        [Fact]
        public void prop_Info()
        {
            using (SerializationFile obj = new SerializationFile(new HttpException()))
            {
                Assert.NotNull(obj.Info);
            }
        }

        [Fact]
        public void Open()
        {
            using (SerializationFile obj = new SerializationFile(new HttpException()))
            {
                using (FileStream file = obj.Open())
                {
                }
            }
        }
    }
}